import { createApp } from "vue"
import App from "./App.vue"
import router from "./router"
import store from "./store"

import ElementPlus from "element-plus"
import "element-plus/dist/index.css"
import locale from "element-plus/lib/locale/lang/zh-cn"

import "@/assets/icons/svg/index.ts"
import VueLazyload from "vue-lazyload"
import "./assets/less/index.less"
import directives from "./directives"
import global from "./global"
import { timer } from "./utils/performance"

const app = createApp(App)
    .use(store)
    .use(router)
    .use(ElementPlus, { locale })
    .use(VueLazyload, {
        preLoad: 1.3,
        error: require("@/assets/img/error.png"),
        loading: require("@/assets/img/loading.gif"),
        attempt: 1
    })

app.config.performance = true

directives.install(app)

app.config.globalProperties.$global = global
app.config.globalProperties.$timer = timer
app.config.globalProperties.$store = store;

app.provide("global", global).provide("timer", timer)

app.mount("#app")

export default app
